Optimal. Leaf size=153 \[ -\frac {3 (4 A-5 B) x}{8 a}+\frac {4 (A-B) \sin (c+d x)}{a d}-\frac {3 (4 A-5 B) \cos (c+d x) \sin (c+d x)}{8 a d}-\frac {(4 A-5 B) \cos ^3(c+d x) \sin (c+d x)}{4 a d}+\frac {(A-B) \cos ^4(c+d x) \sin (c+d x)}{d (a+a \cos (c+d x))}-\frac {4 (A-B) \sin ^3(c+d x)}{3 a d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 153, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3056, 2827,
2713, 2715, 8} \begin {gather*} -\frac {4 (A-B) \sin ^3(c+d x)}{3 a d}+\frac {4 (A-B) \sin (c+d x)}{a d}+\frac {(A-B) \sin (c+d x) \cos ^4(c+d x)}{d (a \cos (c+d x)+a)}-\frac {(4 A-5 B) \sin (c+d x) \cos ^3(c+d x)}{4 a d}-\frac {3 (4 A-5 B) \sin (c+d x) \cos (c+d x)}{8 a d}-\frac {3 x (4 A-5 B)}{8 a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2713
Rule 2715
Rule 2827
Rule 3056
Rubi steps
\begin {align*} \int \frac {\cos ^4(c+d x) (A+B \cos (c+d x))}{a+a \cos (c+d x)} \, dx &=\frac {(A-B) \cos ^4(c+d x) \sin (c+d x)}{d (a+a \cos (c+d x))}+\frac {\int \cos ^3(c+d x) (4 a (A-B)-a (4 A-5 B) \cos (c+d x)) \, dx}{a^2}\\ &=\frac {(A-B) \cos ^4(c+d x) \sin (c+d x)}{d (a+a \cos (c+d x))}-\frac {(4 A-5 B) \int \cos ^4(c+d x) \, dx}{a}+\frac {(4 (A-B)) \int \cos ^3(c+d x) \, dx}{a}\\ &=-\frac {(4 A-5 B) \cos ^3(c+d x) \sin (c+d x)}{4 a d}+\frac {(A-B) \cos ^4(c+d x) \sin (c+d x)}{d (a+a \cos (c+d x))}-\frac {(3 (4 A-5 B)) \int \cos ^2(c+d x) \, dx}{4 a}-\frac {(4 (A-B)) \text {Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{a d}\\ &=\frac {4 (A-B) \sin (c+d x)}{a d}-\frac {3 (4 A-5 B) \cos (c+d x) \sin (c+d x)}{8 a d}-\frac {(4 A-5 B) \cos ^3(c+d x) \sin (c+d x)}{4 a d}+\frac {(A-B) \cos ^4(c+d x) \sin (c+d x)}{d (a+a \cos (c+d x))}-\frac {4 (A-B) \sin ^3(c+d x)}{3 a d}-\frac {(3 (4 A-5 B)) \int 1 \, dx}{8 a}\\ &=-\frac {3 (4 A-5 B) x}{8 a}+\frac {4 (A-B) \sin (c+d x)}{a d}-\frac {3 (4 A-5 B) \cos (c+d x) \sin (c+d x)}{8 a d}-\frac {(4 A-5 B) \cos ^3(c+d x) \sin (c+d x)}{4 a d}+\frac {(A-B) \cos ^4(c+d x) \sin (c+d x)}{d (a+a \cos (c+d x))}-\frac {4 (A-B) \sin ^3(c+d x)}{3 a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(311\) vs. \(2(153)=306\).
time = 0.67, size = 311, normalized size = 2.03 \begin {gather*} \frac {\cos \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \left (-72 (4 A-5 B) d x \cos \left (\frac {d x}{2}\right )-72 (4 A-5 B) d x \cos \left (c+\frac {d x}{2}\right )+552 A \sin \left (\frac {d x}{2}\right )-552 B \sin \left (\frac {d x}{2}\right )+168 A \sin \left (c+\frac {d x}{2}\right )-168 B \sin \left (c+\frac {d x}{2}\right )+144 A \sin \left (c+\frac {3 d x}{2}\right )-120 B \sin \left (c+\frac {3 d x}{2}\right )+144 A \sin \left (2 c+\frac {3 d x}{2}\right )-120 B \sin \left (2 c+\frac {3 d x}{2}\right )-16 A \sin \left (2 c+\frac {5 d x}{2}\right )+40 B \sin \left (2 c+\frac {5 d x}{2}\right )-16 A \sin \left (3 c+\frac {5 d x}{2}\right )+40 B \sin \left (3 c+\frac {5 d x}{2}\right )+8 A \sin \left (3 c+\frac {7 d x}{2}\right )-5 B \sin \left (3 c+\frac {7 d x}{2}\right )+8 A \sin \left (4 c+\frac {7 d x}{2}\right )-5 B \sin \left (4 c+\frac {7 d x}{2}\right )+3 B \sin \left (4 c+\frac {9 d x}{2}\right )+3 B \sin \left (5 c+\frac {9 d x}{2}\right )\right )}{192 a d (1+\cos (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.18, size = 143, normalized size = 0.93
method | result | size |
derivativedivides | \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {2 \left (\left (\frac {25 B}{8}-\frac {5 A}{2}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {115 B}{24}-\frac {31 A}{6}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {109 B}{24}-\frac {25 A}{6}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {7 B}{8}-\frac {3 A}{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}-\frac {3 \left (4 A -5 B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4}}{d a}\) | \(143\) |
default | \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {2 \left (\left (\frac {25 B}{8}-\frac {5 A}{2}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {115 B}{24}-\frac {31 A}{6}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {109 B}{24}-\frac {25 A}{6}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {7 B}{8}-\frac {3 A}{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}-\frac {3 \left (4 A -5 B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4}}{d a}\) | \(143\) |
risch | \(-\frac {3 x A}{2 a}+\frac {15 B x}{8 a}-\frac {7 i {\mathrm e}^{i \left (d x +c \right )} A}{8 d a}+\frac {7 i {\mathrm e}^{i \left (d x +c \right )} B}{8 d a}+\frac {7 i {\mathrm e}^{-i \left (d x +c \right )} A}{8 d a}-\frac {7 i {\mathrm e}^{-i \left (d x +c \right )} B}{8 d a}+\frac {2 i A}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {B \sin \left (4 d x +4 c \right )}{32 d a}+\frac {\sin \left (3 d x +3 c \right ) A}{12 d a}-\frac {\sin \left (3 d x +3 c \right ) B}{12 d a}-\frac {\sin \left (2 d x +2 c \right ) A}{4 d a}+\frac {\sin \left (2 d x +2 c \right ) B}{2 d a}\) | \(228\) |
norman | \(\frac {\frac {\left (A -B \right ) \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}-\frac {3 \left (4 A -5 B \right ) x}{8 a}+\frac {86 \left (A -B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d a}-\frac {15 \left (4 A -5 B \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 a}-\frac {15 \left (4 A -5 B \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 a}-\frac {15 \left (4 A -5 B \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 a}-\frac {15 \left (4 A -5 B \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 a}-\frac {3 \left (4 A -5 B \right ) x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 a}+\frac {5 \left (8 A -9 B \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d a}+\frac {\left (16 A -11 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d a}+\frac {\left (98 A -95 B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d a}+\frac {\left (152 A -155 B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d a}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{5}}\) | \(300\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 394 vs.
\(2 (145) = 290\).
time = 0.48, size = 394, normalized size = 2.58 \begin {gather*} -\frac {B {\left (\frac {\frac {21 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {109 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + \frac {115 \, \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}} + \frac {75 \, \sin \left (d x + c\right )^{7}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{7}}}{a + \frac {4 \, a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {6 \, a \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}} + \frac {4 \, a \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}} + \frac {a \sin \left (d x + c\right )^{8}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{8}}} - \frac {45 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} + \frac {12 \, \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - 4 \, A {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {16 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + \frac {15 \, \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}}}{a + \frac {3 \, a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {3 \, a \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}} + \frac {a \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}}} - \frac {9 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} + \frac {3 \, \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )}}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.34, size = 120, normalized size = 0.78 \begin {gather*} -\frac {9 \, {\left (4 \, A - 5 \, B\right )} d x \cos \left (d x + c\right ) + 9 \, {\left (4 \, A - 5 \, B\right )} d x - {\left (6 \, B \cos \left (d x + c\right )^{4} + 2 \, {\left (4 \, A - B\right )} \cos \left (d x + c\right )^{3} - {\left (4 \, A - 13 \, B\right )} \cos \left (d x + c\right )^{2} + {\left (28 \, A - 19 \, B\right )} \cos \left (d x + c\right ) + 64 \, A - 64 \, B\right )} \sin \left (d x + c\right )}{24 \, {\left (a d \cos \left (d x + c\right ) + a d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 1794 vs.
\(2 (134) = 268\).
time = 2.20, size = 1794, normalized size = 11.73 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.42, size = 181, normalized size = 1.18 \begin {gather*} -\frac {\frac {9 \, {\left (d x + c\right )} {\left (4 \, A - 5 \, B\right )}}{a} - \frac {24 \, {\left (A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{a} - \frac {2 \, {\left (60 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 75 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 124 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 115 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 100 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 109 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 36 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 21 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{4} a}}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.38, size = 170, normalized size = 1.11 \begin {gather*} \frac {15\,B\,x}{8\,a}-\frac {3\,A\,x}{2\,a}+\frac {7\,A\,\sin \left (c+d\,x\right )}{4\,a\,d}-\frac {7\,B\,\sin \left (c+d\,x\right )}{4\,a\,d}-\frac {A\,\sin \left (2\,c+2\,d\,x\right )}{4\,a\,d}+\frac {A\,\sin \left (3\,c+3\,d\,x\right )}{12\,a\,d}+\frac {A\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a\,d}+\frac {B\,\sin \left (2\,c+2\,d\,x\right )}{2\,a\,d}-\frac {B\,\sin \left (3\,c+3\,d\,x\right )}{12\,a\,d}+\frac {B\,\sin \left (4\,c+4\,d\,x\right )}{32\,a\,d}-\frac {B\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________